'''
表达式是对item进行操作  可以是三目:       结果 if  表达式  else 结果
条件是对对item进行过滤
[表达式 for item in list if 条件]
'''



# for循环方式
new_list = []
for i in range(0, 21):
    if i % 2 == 0:
        new_list.append(i)

print(new_list)

# 列表推导式
list1 = [i for i in new_list if i % 2 == 0]
print(list1)


# if else
names = ['JackMa', 'Kene', 'BillGates']
names_value = []
for i in names:
    if len(i)<8:
        names_value.append(i.lower())
    else:
        names_value.append(i.upper())
print(names_value)

names_value1 = [i.lower() if len(i)<8 else i.upper() for i in names]
print(names_value)

